package coco.neo4j.com.module.distribution.repository;

import coco.neo4j.com.module.distribution.entity.Dealer;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;

import java.util.List;


/**
 * @author niky
 */
public interface DealerRepository extends Neo4jRepository<Dealer, Long> {

    Dealer findByLabelName(String labelName);

    Dealer findByDealerId(Long dealerId);

    /**
     * 返回某个人下面的所有经销
     */
    @Query("match data=(na:dealer{dealerId:$dealerId})-[*1..1]->(nb:dealer) return data")
    List<Dealer> findShipByDealer(Long dealerId);
}